package com.spic.business.blast.controller;

import com.spic.business.blast.domain.WeightData;
import com.spic.business.blast.service.BlastWeightService;
import com.spic.common.core.web.controller.BaseController;
import com.spic.common.core.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * WeightSyncController
 *
 * @author xuxiaochang@chinasofi.com
 * @date 2022/6/16
 */
@RestController
@RequestMapping("sync")
public class WeightSyncController extends BaseController
{
    @Autowired
    private BlastWeightService blastWeightService;

    @PostMapping("weight")
    public AjaxResult syncWeight(@RequestBody List<WeightData> weightData)
    {
        boolean b = blastWeightService.saveOrUpdateBatch(weightData);
        return b ? AjaxResult.success() : AjaxResult.error();
    }

}
